package value;

/**
 * @author fei.fang
 * @date 2021/8/31
 **/
public class ValueTest {

    public static void main(String[] args) {

        Demo demo = new Demo();
        demo.setName("test");
        change(demo);
        System.out.println(demo.getName());
    }

    private static void change(Demo demo){
        demo.setName("test2");
        Demo d1 = new Demo();
        d1.setName("2");
        demo = d1;
        System.out.println(demo.getName());
    }

    public static class Demo {
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
